using System;
using System.Drawing;

namespace TouchSmart.Gestures
{
    public class InitialMovementArea
    {
        private const int Delta = 1;

        private Point _initialLocation;
        private Point _currentLoction;

        public InitialMovementArea(Point initialLocation)
        {
            _initialLocation = initialLocation;
            _currentLoction = initialLocation;
        }

        public void RecordMovement(Point vector)
        {
            this._currentLoction = new Point(this._currentLoction.X + vector.X, this._currentLoction.Y + vector.Y);
        }

        public bool IsMovement
        {
            get
            {
                return Math.Abs(this._initialLocation.X - this._currentLoction.X) > Delta ||
                       Math.Abs(this._initialLocation.Y - this._currentLoction.Y) > Delta;
            }   
        }

        public Point GetMovement()
        {
            return new Point(
                this._currentLoction.X - this._initialLocation.X, 
                this._currentLoction.Y - this._initialLocation.Y);
        }
    }
}